<template>
	<view class="content">
		<view class="ability">
			<!-- 微信 -->
			<view class="wx">
				<button open-type="share">
					<image src="../../static/images/share/微信.png" mode=""></image>
					<text>微信</text>
				</button>
			</view>
			<!-- 朋友圈 -->
			<view class="friend">
				<!-- <button @click="friends()" open-type="contactShare"> -->
					<image @click="friends('www.baidu.com')" src="../../static/images/share/朋友圈.png" mode=""></image>
					<text>朋友圈</text>
				<!-- </button> -->
				
			</view>
			<!-- 链接 -->
			<view class="interlinkage">
				<button open-type="share">
					<image src="../../static/images/share/链接.png" mode=""></image>
					<text>复制链接</text>
				</button>
			</view>
		</view>
		<view class="text">
			<text>取消</text>
		</view>
	</view>
</template>

<script>
	export default {
		name:'share',
		props:{
			routingPath:String, //路由路径
			title:String,//分享内容的标题
			summary:String,//分享内容的摘要
			href:String,//跳转链接
			imageUrl:String,//图片地址
			miniProgram:String,//分享小程序必要参数
		},
		data() {
			return {
				Text:this.popup
			}
		},
		beforeMount() {
			if (this.popup) {
				console.log("到这里了")
			}
		},
		methods: {
			// 分享到朋友圈
			friends(share_url){
				 console.log('调用系统分享');
				  var msg = { content: "我喜欢这个菜谱:", href: share_url };
				  plus.share.sendWithSystem ? plus.share.sendWithSystem(msg, function () {
				    console.log('Success');
				  }, function (e) {
				    console.log('Failed: ' + JSON.stringify(e));
				  }) : shareSystemNativeJS();
			},
			shareSystemNativeJS() {
			  if (plus.os.name !== 'Android') {
			    plus.nativeUI.alert('此平台暂不支持系统分享功能!');
			    return;
			  }
			  var intent = new Intent(Intent.ACTION_SEND);
			  intent.setType('text/plain');
			  intent.putExtra(Intent.EXTRA_SUBJECT, 'HelloH5');
			  intent.putExtra(Intent.EXTRA_TEXT, sharecontent.value);
			  intent.setFlags(Intent.FLAG_ACTIVITY_NEW_TASK);
			  main.startActivity(Intent.createChooser(intent, '系统分享HelloH5'));
			}
		}
	}
</script>

<style>
	// 取消登录button默认样式
	button{
		margin:0;
	    padding:0;
	    border-radius:0;
	    border:none;
	    background-color:transparent;
	}
	
	button::after{
		border: none;
	}
.content{
	width: 100%;
	display: flex;
	flex-direction: column;
}
.ability{
	width: 100%;
	display: flex;
	justify-content: space-around;
}
.wx{
	width: 165rpx;
	height: 165rpx;
	margin-top: 15rpx;
}
.friend{
	width: 190rpx;
	height: 190rpx;
}
.interlinkage{
	width: 180rpx;
	height: 180rpx;
}
.wx,.friend,.interlinkage{
	display: flex;
	flex-direction: column;
	justify-content: center;
	text-align: center;
}
button{
	display: flex;
	flex-direction: column;
	justify-content: center;
}

.wx button image,.friend button image,.interlinkage button image{
	width: 60%;
	margin: auto;
}
.text{
	border-top: 2rpx #222429 solid;
	font-size: 40rpx;
	text-align: center;
}
</style>
